import { EditProfileType } from '@/store/reducer/user';
import request from '../utils/request';
//获取验证码
export const getCodeApi = (mobile: string) => {
  return request({
    url: '/v1_0/sms/codes/' + mobile,
  });
};
//登录
export const loginApi = (data: { mobile: string; code: string }) => {
  return request({
    url: '/v1_0/authorizations',
    method: 'post',
    data,
  });
};
//获取自己信息（个人中心）
export const getUserInfoApi = () => {
  return request({
    url: '/v1_0/user',
  });
};
//获取用户个人资料（个人资料）
export const getUserProfileApi = () => {
  return request({
    url: '/v1_0/user/profile',
  });
};

export const editProfileApi = (data: EditProfileType) => {
  return request({
    url: '/v1_0/user/profile',
    method: 'patch',
    data,
  });
};
export const uploadPhotoApi = (data: FormData) => {
  return request({
    url: '/v1_0/user/photo',
    method: 'patch',
    data,
  });
};
